home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / mail / pine3.96.tar.gz / pine3.96.tar / pine3.96 / imap / ANSI / c-client / env_t20.c < prev    next >
C/C++ Source or Header  |  1994-09-07  |  3KB  |  94 lines

  1. /*
  2.  * Program:    Environment routines -- TOPS-20 version
  3.  *
  4.  * Author:    Mark Crispin
  5.  *        6158 Lariat Loop NE
  6.  *        Bainbridge Island, WA  98110-2098
  7.  *        Internet: MRC@Panda.COM
  8.  *
  9.  * Date:    1 August 1988
  10.  * Last Edited:    7 September 1994
  11.  *
  12.  * Copyright 1994 by Mark Crispin
  13.  *
  14.  *  Permission to use, copy, modify, and distribute this software and its
  15.  * documentation for any purpose and without fee is hereby granted, provided
  16.  * that the above copyright notices appear in all copies and that both the
  17.  * above copyright notices and this permission notice appear in supporting
  18.  * documentation, and that the name of Mark Crispin not be used in advertising
  19.  * or publicity pertaining to distribution of the software without specific,
  20.  * written prior permission.  This software is made available "as is", and
  21.  * MARK CRISPIN DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD TO
  22.  * THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED WARRANTIES OF
  23.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND IN NO EVENT SHALL
  24.  * MARK CRISPIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES
  25.  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  26.  * WHETHER IN AN ACTION OF CONTRACT, TORT (INCLUDING NEGLIGENCE) OR STRICT
  27.  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
  28.  * THIS SOFTWARE.
  29.  *
  30.  */
  31.  
  32.  
  33. /* Dedication:
  34.  * This file is dedicated with affection to the TOPS-20 operating system, which
  35.  * set standards for user and programmer friendliness that have still not been
  36.  * equaled by more `modern' operating systems.
  37.  * Wasureru mon ka!!!!
  38.  */
  39.  
  40. /* Environment manipulate parameters
  41.  * Accepts: function code
  42.  *        function-dependent value
  43.  * Returns: function-dependent return value
  44.  */
  45.  
  46. void *env_parameters (long function,void *value)
  47. {
  48.   return NIL;
  49. }
  50.  
  51. /* Write current time in RFC 822 format
  52.  * Accepts: destination string
  53.  */
  54.  
  55. void rfc822_date (char *date)
  56. {
  57.   int zone;
  58.   char *zonename;
  59.   struct tm *t;
  60.   struct timeval tv;
  61.   struct timezone tz;
  62.   gettimeofday (&tv,&tz);    /* get time and timezone poop */
  63.   t = localtime (&tv.tv_sec);    /* convert to individual items */
  64.   zone = -tz.tz_minuteswest;    /* TOPS-20 doesn't have tm_gmtoff or tm_zone */
  65.   zonename = timezone (tz.tz_minuteswest,t->tm_isdst);
  66.                 /* and output it */
  67.   sprintf (date,"%s, %d %s %d %02d:%02d:%02d %+03d%02d (%s)",
  68.        days[t->tm_wday],t->tm_mday,months[t->tm_mon],t->tm_year+1900,
  69.        t->tm_hour,t->tm_min,t->tm_sec,
  70.        (t->tm_isdst ? 1 : 0) + zone/60,abs (zone) % 60,zonename);
  71. }
  72.  
  73.  
  74. /* Write current time in internal format
  75.  * Accepts: destination string
  76.  */
  77.  
  78. void internal_date (char *date)
  79. {
  80.   int zone;
  81.   char *zonename;
  82.   struct tm *t;
  83.   struct timeval tv;
  84.   struct timezone tz;
  85.   gettimeofday (&tv,&tz);    /* get time and timezone poop */
  86.   t = localtime (&tv.tv_sec);    /* convert to individual items */
  87.   zone = -tz.tz_minuteswest;    /* TOPS-20 doesn't have tm_gmtoff or tm_zone */
  88.                 /* and output it */
  89.   sprintf (date,"%2d-%s-%d %02d:%02d:%02d %+03d%02d",
  90.        t->tm_mday,months[t->tm_mon],t->tm_year+1900,
  91.        t->tm_hour,t->tm_min,t->tm_sec,
  92.        (t->tm_isdst ? 1 : 0) + zone/60,abs (zone) % 60);
  93. }
  94.